package com.qf.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.Set;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/10/19 20:01
 */
@FeignClient("sms-platform-cache")
@RequestMapping("/cache")
public interface CacheFeign {
    @RequestMapping(value = "/hmget/{key}", method = RequestMethod.GET)
    public Map hMGet(@PathVariable("key") String key);

    @RequestMapping(value = "/get/{key}", method = RequestMethod.GET)
    public String get(@PathVariable("key") String key);

    // 对hash结构的某一个field进行incr操作
    @PostMapping("/hincr")
    public Long hincr(@RequestParam(value = "key")String key, @RequestParam(value = "field")String field, @RequestParam(value = "delta")Long delta);

    // zset结构的根据分数查询数据
    @RequestMapping(value = "/zrangebyscore/{key}",method = RequestMethod.GET)
    public Set<String> zRangeByScore(@PathVariable(value = "key") String key,
                                     @RequestParam("min") Long min,
                                     @RequestParam(value = "max") Long max);

    //通配获取key集合
    @GetMapping(value = "/keys/{key}")
    public Set<String> keys(@PathVariable(value = "key")String key);
}
